const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
exports.main = async event => {
  try {
    let users = await db.collection('user').get()
    let total = users.data ? users.data.length : 0
    return total
  } catch (err) {
    console.log(err)
    return err
  }
}
